// 自定义弹窗组件样式，仿照Element UI
// 变量定义
$primary-color: #409EFF;
$success-color: #67C23A;
$warning-color: #E6A23C;
$danger-color: #F56C6C;
$info-color: #909399;

$border-color-light: #EBEEF5;
$text-color-primary: #303133;
$text-color-regular: #606266;
$text-color-secondary: #909399;

$font-size-base: 14px;
$font-size-large: 16px;
$font-size-small: 13px;

$border-radius-base: 4px;
$box-shadow-base: 0 2px 12px 0 rgba(0, 0, 0, 0.1);

// 遮罩层
.custom-dialog-overlay {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 2000;
  background-color: rgba(0, 0, 0, 0.5);
  overflow: auto;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: opacity 0.3s;
  
  &.is-hidden {
    opacity: 0;
    visibility: hidden;
  }
}

// 弹窗容器
.custom-dialog {
  position: relative;
  margin: 0 auto;
  background-color: #fff;
  border-radius: $border-radius-base;
  box-shadow: $box-shadow-base;
  min-width: 420px;
  max-width: 90%;
  display: flex;
  flex-direction: column;
  transform: translateY(0);
  transition: transform 0.3s, opacity 0.3s;
  
  &.is-hidden {
    transform: translateY(-20px);
    opacity: 0;
  }
  
  // 弹窗头部
  &__header {
    padding: 20px 20px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    
    .title {
      font-size: $font-size-large;
      color: $text-color-primary;
      font-weight: 500;
      line-height: 1;
    }
    
    .close {
      cursor: pointer;
      color: $text-color-secondary;
      font-size: 20px;
      transition: color 0.2s;
      
      &:hover {
        color: $text-color-primary;
      }
    }
  }
  
  // 弹窗内容
  &__body {
    padding: 10px 20px;
    color: $text-color-regular;
    font-size: $font-size-base;
    word-break: break-word;
    
    // 图标和内容的布局
    &.with-icon {
      display: flex;
      align-items: flex-start;
      padding: 20px;
      
      .icon {
        margin-right: 15px;
        font-size: 24px;
        
        &.success {
          color: $success-color;
        }
        
        &.warning {
          color: $warning-color;
        }
        
        &.error {
          color: $danger-color;
        }
        
        &.info {
          color: $info-color;
        }
      }
      
      .content {
        flex: 1;
      }
    }
  }
  
  // 弹窗底部
  &__footer {
    padding: 10px 20px 20px;
    text-align: right;
    
    .btn {
      display: inline-block;
      line-height: 1;
      white-space: nowrap;
      cursor: pointer;
      background: #fff;
      border: 1px solid #dcdfe6;
      color: $text-color-regular;
      text-align: center;
      box-sizing: border-box;
      outline: none;
      margin: 0;
      transition: .1s;
      font-weight: 500;
      padding: 9px 15px;
      font-size: $font-size-base;
      border-radius: $border-radius-base;
      margin-left: 10px;
      
      &:hover {
        color: $primary-color;
        border-color: #c6e2ff;
        background-color: #ecf5ff;
      }
      
      &:active {
        color: darken($primary-color, 10%);
        border-color: darken($primary-color, 10%);
        outline: none;
      }
      
      &.primary {
        color: #fff;
        background-color: $primary-color;
        border-color: $primary-color;
        
        &:hover {
          background-color: lighten($primary-color, 10%);
          border-color: lighten($primary-color, 10%);
        }
        
        &:active {
          background-color: darken($primary-color, 10%);
          border-color: darken($primary-color, 10%);
        }
      }
      
      &.danger {
        color: #fff;
        background-color: $danger-color;
        border-color: $danger-color;
        
        &:hover {
          background-color: lighten($danger-color, 10%);
          border-color: lighten($danger-color, 10%);
        }
        
        &:active {
          background-color: darken($danger-color, 10%);
          border-color: darken($danger-color, 10%);
        }
      }
    }
  }
}

// 动画效果
@keyframes dialog-fade-in {
  0% {
    opacity: 0;
    transform: translateY(-20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes dialog-fade-out {
  0% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(-20px);
  }
}

.dialog-fade-enter-active {
  animation: dialog-fade-in 0.3s;
}

.dialog-fade-leave-active {
  animation: dialog-fade-out 0.3s;
}